package com.cj.simple;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.Toast;

import com.cj.library.widget.view.TimerView;

/**
 * Created by JiangGe on 2016/9/6.
 */
public class TimerActivity extends Activity {
    private TimerView timer_view;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_timer);
        timer_view = (TimerView) findViewById(R.id.timer_view);
        timer_view.setOnTimerListener(new TimerView.OnTimerListener() {
            @Override
            public void onTimerStart() {
                Toast.makeText(TimerActivity.this, "开始", Toast.LENGTH_SHORT).show();
            }

            @Override
            public void onTimerComplete() {
                Toast.makeText(TimerActivity.this, "结束", Toast.LENGTH_SHORT).show();
            }
        });

        timer_view.start();
        final TimerView timerView = ((TimerView) findViewById(R.id.timer_view_01));
        timerView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (!timerView.isStart()) {
                    timerView.start();
                } else {
                    timerView.stop();
                }
            }
        });

        ((TimerView) findViewById(R.id.timer_view_02)).start();
        ((TimerView) findViewById(R.id.timer_view_03)).start();
        ((TimerView) findViewById(R.id.timer_view_04)).start();
        ((TimerView) findViewById(R.id.timer_view_05)).start();
        ((TimerView) findViewById(R.id.timer_view_06)).start();
    }
}
